package cn.mesmile.code.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author zb
 * @date 2021/4/26 15:20
 * @Description
 */
@TableName(value = "student")
@Data
@ApiModel(value = "返回查询员工结果", description = "返回查询员工结果")
public class Student implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     *
     *  1）【强制】所有的 POJO 类属性必须使用包装数据类型。
     *
     *  2）【强制】RPC 方法的返回值和参数必须使用包装数据类型。
     *
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "id", example = "1", notes = "id为主键索引", required = true)
    private Long id;

    @ApiModelProperty(value = "用户名", example = "张三", notes = "用户名是唯一的", required = true)
    private String username;

    @ApiModelProperty(value = "密码", example = "admin123", notes = "密码是通过加密存储", required = true)
    private String password;

    @ApiModelProperty(value = "是否发版", example = "true", notes = "是否发版", required = true)
    private Boolean publish;

    @ApiModelProperty(value = "年龄", example = "18", notes = "代表用户年龄,整数", required = true)
    private Integer age;

    @ApiModelProperty(value = "性别", example = "1", notes = "0代表女，1代表男", required = true)
    private Integer sex;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "创建时间", example = "2021-04-19 12:20:23", notes = "创建时间", required = true)
    private Date createDateTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "修改时间", example = "2021-04-19 12:20:23", notes = "修改时间", required = true)
    private Date modifiedDateTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    @ApiModelProperty(value = "生日", example = "2021-04-19", notes = "生日", required = true)
    private Date birthday;

    /*
     * @Temporal(TemporalType.DATE) 日期注解,标识存储到数据库的类型为 日期
     *
     * @DatetimeFormat是将String转换成Date，一般前台给后台传值时用
     *
     * @JsonFormat(pattern="yyyy-MM-dd") 将Date转换成String 一般后台传值给前台时
     *
     * @JsonFormat会让时间以0区时间显示。如果直接使用会少了8小时修改为
     *
     * @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
     *
     */

}
